<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('options', function (Blueprint $table) {
            $table->id();
            $table->integer('paper_id')->default(0)->comment('问卷ID');
            $table->integer('question_id')->default(0)->comment('题目ID');
            $table->string('value')->comment('选项值');
            $table->text('desc')->nullable()->comment('选项描述');
            $table->integer('sort')->nullable()->default(0)->comment('排序');

            $table->index('paper_id');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `options` comment '选项'");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('options');
    }
};
